package com.why.rpc.core.common.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;

/**
 * @program: why-rpc-framework
 * @description: 注册中心
 * @author: @why
 * @create: 2021-03-18 20:06
 **/
public class ProPertiesUtils {
    private static String RPC_HOST = "rpc.?.host";
    private static String RPC_PORT = "rpc.?.port";

    public static Map<String, String> getRegistryLocation() throws IOException {
        Properties properties = new Properties();
        InputStream stream = ProPertiesUtils.class.getClassLoader().getResourceAsStream("rpc.properties");
        properties.load(stream);
        String host = properties.getProperty("rpc.nacos.host");
        RPC_HOST = RPC_HOST.replace("?", host);
        String port=properties.getProperty("rpc.nacos.port");
        RPC_PORT = RPC_PORT.replace("?", port);

        System.out.println(RPC_HOST+"\t"+RPC_PORT);
        return  null;
    }

    public static void main(String[] args) throws IOException {
        getRegistryLocation();
    }
}
